<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.CGFrame.struts.POJOs.Make" %>
<%@ page import="com.CGFrame.struts.POJOs.Task" %>
<%@ page import="com.CGFrame.struts.POJOs.Status" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String unitName=(String)request.getAttribute("unitName");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">  
	<LINK href="styles/sciencee.css"  type=text/css rel=stylesheet>
	<LINK href="styles/stylewang.css"  type=text/css rel=stylesheet>
	<script language=javascript>
		function sub(){
			window.location.href="<%=basePath%>jobSchedule/changeStatus.do?result="+getResult();

		}
		function getResult(){
			// makeId,statusId;makeId,statusId;makeId,statusId;
			var ids=document.getElementsByName("makeId");
			var result="";
			for(var i=0;i<ids.length;i++){
				result+=ids[i].value+",";
				
				result+=document.getElementById(ids[i].value).value+";";
			}
			return result;
		}
	</script>
  </head>
  
  <body>
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
    		<td align="left" colspan="3" id="onlybt"><%=unitName%></td>
    	</tr>
    	<%
    		Set makes=(Set)request.getAttribute("makes");
    		if(makes!=null && makes.size()!=0){
    			List statuses=(List)request.getAttribute("status");
    			for(Iterator iter=makes.iterator();iter.hasNext();){
    				Make make=(Make)iter.next();
    				String makeName=make.getMakeName();
    				Integer makeId=make.getMakeId();
    				String currentName=make.getStatus().getStatusName();
    	 %>
    				<tr>
    					<td align="left" id="btleftbian"><%=makeName %><input name="makeId" type="hidden" value="<%=makeId %>"></td>
		  				<td id="leftcenter">
    						<select id="<%=makeId %>">
    						<%for(Iterator iter1=statuses.iterator();iter1.hasNext();){
    							Status status=(Status)iter1.next();
    							String name=status.getStatusName();
    							Integer id=status.getStatusId();
    						 %>
    							<option value="<%=id %>" <%=(name.equals(currentName))?"selected":"" %>><%=name %></option>
    						<%} %>
    						</select>
    					</td>
    					<td id="rightcenter">
    					
    					<%
    						for(Iterator ite_Tasks = make.getTasks().iterator();ite_Tasks.hasNext();)
    						{
    							Task task = (Task)ite_Tasks.next();
    							if ( task.getReguser() != null) 
    							{
    								%>
    								<%=task.getReguser().getRegName() %>
    								<%
    							}
    						}
    					 %>
    						&nbsp;
    					</td>	
    				</tr>
    			<%}%>
                <tr><td colspan="3" id="tdtop" heigth="1">&nbsp;</td></tr>
    			<tr>
    				<td colspan="3" align="center"><input type="button" onClick="sub();" value='<bean:message key="submit"/>'>    				  <input type="button" onClick="new parent.dialog().reset();" value='<bean:message key="close"/>'></td>
   				</tr>
    		<%}else{%>
    			<tr>
    				<td><bean:message key="make.nomake"/></td>
    				<td><input type="button" onClick="new parent.dialog().reset();" value='<bean:message key="close"/>'></td>
    			</tr>
    		<%} %>
    </table>
  
  </body>
</html>
